package com.bitdf.txing.users.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.bitdf.txing.common.utils.R;
import com.bitdf.txing.users.entity.UserGroupCollectEntity;
import com.bitdf.txing.users.service.UserGroupCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

/**
 * 
 *
 * @author Lizhiwei
 * @email 123@qq.com
 * @date 2022-09-05 11:22:35
 */
@RestController
@RequestMapping("${txing.request.path.users}/usergroupcollect")
public class UserGroupCollectController {
    @Autowired
    private UserGroupCollectService userGroupCollectService;

    /**
     * 列表
     */
//    @RequestMapping("/list")
//    public R list(@RequestBody UserOtherInfoQueryVo queryVo){
//
//        PageUtils page = userGroupCollectService.queryPage(queryVo);
//
//        return R.ok().put("page", page);
//    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		UserGroupCollectEntity userGroupCollect = userGroupCollectService.getById(id);

        return R.ok().put("userGroupCollect", userGroupCollect);
    }

    /**
     * 保存
     */
    @SaCheckLogin
    @RequestMapping("/save")
    public R save(@RequestBody UserGroupCollectEntity userGroupCollect){
		userGroupCollectService.save(userGroupCollect);
        return R.ok();
    }

    /**
     * 修改
     */
    @SaCheckLogin
    @RequestMapping("/update")
    public R update(@RequestBody UserGroupCollectEntity userGroupCollect){
		userGroupCollectService.updateById(userGroupCollect);

        return R.ok();
    }

    /**
     * 删除
     */
    @SaCheckLogin
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		userGroupCollectService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
